= form_for @user, url: profile_path, method: :put, html: { multipart: true, class: "edit-user prepend-top-default" }, authenticity_token: true do |f|
  = form_errors(@user)

  .row
    .col-lg-3.profile-settings-sidebar
      %h4.prepend-top-0
        公开头像
      %p
        - if @user.avatar?
          在这里修改头像
          - if gravatar_enabled?
            或者删除当前头像使用 #{link_to Gitlab.config.gravatar.host, "http://" + Gitlab.config.gravatar.host} 头像
        - else
          在这里上传头像
          - if gravatar_enabled?
            或者在 #{link_to Gitlab.config.gravatar.host, "http://" + Gitlab.config.gravatar.host} 修改头像
    .col-lg-9
      .clearfix.avatar-image.append-bottom-default
        = image_tag avatar_icon(@user, 160), alt: '', class: 'avatar s160'
      %h5.prepend-top-0
        上传新的头像
      .prepend-top-5.append-bottom-10
        %a.btn.js-choose-user-avatar-button
          浏览文件...
        %span.avatar-file-name.prepend-left-default.js-avatar-filename 没有选择文件
        = f.file_field :avatar, class: "js-user-avatar-input hidden", accept: "image/*"
      .help-block
        允许的最大文件大小 200KB。
      - if @user.avatar?
        %hr
        = link_to '删除头像', profile_avatar_path, data: { confirm: "确定要删除头像么？"}, method: :delete, class: "btn btn-gray"
  %hr
  .row
    .col-lg-3.profile-settings-sidebar
      %h4.prepend-top-0
        主要设置
      %p
        此信息会显示在个人资料页面上。
        - if current_user.ldap_user?
          部分设置对于 LDAP 账号无效
    .col-lg-9
      .form-group
        = f.label :name, "姓名", class: "label-light"
        = f.text_field :name, class: "form-control", required: true
        %span.help-block 输入你的名字，让其他人认识你。

      .form-group
        = f.label :email, "邮箱", class: "label-light"
        - if @user.ldap_user? && @user.ldap_email?
          = f.text_field :email, class: "form-control", required: true, readonly: true
          %span.help-block.light
            LDAP 用户的邮箱自动设置。
        - else
          - if @user.temp_oauth_email?
            = f.text_field :email, class: "form-control", required: true, value: nil
          - else
            = f.text_field :email, class: "form-control", required: true
          - if @user.unconfirmed_email.present?
            %span.help-block
              请点击确认邮件中的链接继续操作。其已经被发送到
              = succeed "。" do
                %strong #{@user.unconfirmed_email}
              %p
              = link_to "重发确认邮件", user_confirmation_path(user: { email: @user.unconfirmed_email }), method: :post

          - else
            %span.help-block 如果没有上传头像将使用邮箱头像服务。
      .form-group
        = f.label :public_email, '公开邮箱', class: "label-light"
        = f.select :public_email, options_for_select(@user.all_emails, selected: @user.public_email), {include_blank: '不在个人资料中显示'}, class: "select2"
        %span.help-block 此邮箱将显示在公开的个人资料上。
      .form-group
        = f.label :skype, class: "label-light"
        = f.text_field :skype, class: "form-control"
      .form-group
        = f.label :linkedin, '领英', class: "label-light"
        = f.text_field :linkedin, class: "form-control"
      .form-group
        = f.label :twitter, '推特', class: "label-light"
        = f.text_field :twitter, class: "form-control"
      .form-group
        = f.label :website_url, '网址', class: "label-light"
        = f.text_field :website_url, class: "form-control"
      .form-group
        = f.label :location, '位置', class: "label-light"
        = f.text_field :location, class: "form-control"
      .form-group
        = f.label :bio, '简历', class: "label-light"
        = f.text_area :bio, rows: 4, class: "form-control", maxlength: 250
        %span.help-block 使用少于 250 字符的文字描述自己。
      .prepend-top-default.append-bottom-default
        = f.submit '更新个人资料设置', class: "btn btn-success"
        = link_to "取消", user_path(current_user), class: "btn btn-cancel"

.modal.modal-profile-crop
  .modal-dialog
    .modal-content
      .modal-header
        %button.close{:type => "button", :'data-dismiss' => "modal"}
          %span
            &times;
        %h4.modal-title
          Position and size your new avatar
      .modal-body
        .profile-crop-image-container
          %img.modal-profile-crop-image
        .crop-controls
          .btn-group
            %button.btn.btn-primary{ data: { method: "zoom", option: "0.1" } }
              %span.fa.fa-search-plus
            %button.btn.btn-primary{ data: { method: "zoom", option: "-0.1" } }
              %span.fa.fa-search-minus
      .modal-footer
        %button.btn.btn-primary.js-upload-user-avatar{:type => "button"}
          Set new profile picture
